package com.yonyou.jt.mapper;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;

/**
 * @description:
 * @projectName:zyhyspring2024-be
 * @see:com.yonyou.jt.controller
 * @author:姜涛
 * @createTime:2024/2/23 11:25
 * @version:1.0
 */

@Mapper
public interface JtExpenseCardMapper {
    @Update("update jt_card\n" +
            "        set actual_occupy = ifnull(actual_occupy,0) + #{occupy},\n" +
            "            actual_budget =  ifnull(actual_budget,0) - #{occupy}\n" +
            "        where project = #{project}\n" +
            "          and dr = 0")
    void updateOccupyByProject(@Param("project") String projectId, @Param("occupy") BigDecimal occupy);

}
